function Tag(config={}){
	const el = document.querySelector(config.el);
	this.btns = el.querySelectorAll("button");
	this.divs = el.querySelectorAll("div");
	this.index = config.index || 0;
	this.colorArr = config.colorArr || ["red","blue","yellow"];
	this.init();
}
Object.assign(Tag.prototype,{
	init(){
		this.btns.forEach((btn,i)=>{
			btn.onclick = ()=>{
				
				if(this.index===i) return;
				this.hide();
				this.index = i;
				this.show();
			}
			this.hide(i);
		})
		this.show();
	},
	
	hide(i=this.index){
		this.btns[i].style.background  = this.divs[i].style.background= null;
		this.divs[i].style.display = "none";
	},
	show(){
		this.btns[this.index].style.background = this.divs[this.index].style.background =  this.colorArr[this.index];
		this.divs[this.index].style.display = "block";
	}
})


function StrongTag(config){
	Tag.call(this,config);
	this.autoTag();
}
StrongTag.prototype = Tag.prototype;
StrongTag.prototype.constructor = StrongTag;
StrongTag.prototype.autoTag = function(){
	setInterval(()=>{
		this.hide();
		this.index++;
		if(this.index>this.btns.length-1){
			this.index=0;
		}
		this.show();
	},3000)
}